<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>延期管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function() {
			
		});
		function page(n,s){
			$("#pageNo").val(n);
			$("#pageSize").val(s);
			$("#searchForm").submit();
        	return false;
        }
		
		function jujue(id,uid){
			$("#id").val(id);
			$('#demoModal').modal('show');
			  $.ajax({  
		         url : "${ctx}/numberinfo/yhcgNumberinfo/formcha",  
		         type : "POST",  
		         data : {"id":uid},
		         success : function(data) { 
		        	  document.getElementById("come1").innerHTML = data.come;
		        	  document.getElementById("type1").innerHTML = data.type; 
		        	  document.getElementById("content1").innerHTML = data.content; 
		        	  document.getElementById("remark1").innerHTML = data.remark; 
		         },  
		         error : function(data) {  
		             alert("无法查看信息");
		         }  
		    });   
			  $.ajax({  
			         url : "${ctx}/delay/yhcgDelay/formcha",  
			         type : "POST",  
			         data : {"id":id},
			         success : function(data) { 
			        	  document.getElementById("shenyuan").innerHTML = data.reasonsfodelay;
			        	  document.getElementById("shenren").innerHTML = data.name; 
			        	  $("#extensiondays").val(data.extensiondays);
			         },  
			         error : function(data) {  
			             alert("无法查看信息");
			         }  
			    });   
			
		}
		
		function shangchuan(){
			if($("#shenuser").val()!=null&&$("#shenuser").val()!=""){
				if($("#status1").val()==2){
					if($("#ju").val()!=null&&$("#ju").val()!=""){
						$("#formdatayan").submit();	
					}else{
						alert("请输入拒绝原因");
					}
				}else{
					$("#formdatayan").submit();	
				}
			}else{
				alert("请输入审核人");
			}
				
		}
		
		
	</script>
</head>
<body>

	<ul class="nav nav-tabs">
		<li class="active"><a href="${ctx}/delay/yhcgDelay/">延期列表</a></li>
		<%-- <shiro:hasPermission name="delay:yhcgDelay:edit"><li><a href="${ctx}/delay/yhcgDelay/form">延期添加</a></li></shiro:hasPermission> --%>
	</ul>
	<form:form id="searchForm" modelAttribute="yhcgDelay" action="${ctx}/delay/yhcgDelay/list" method="post" class="breadcrumb form-search">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
			<ul class="ul-form">
			<li><label>编号：</label>
				<form:input path="number" htmlEscape="false" maxlength="255" class="input-medium"/>
			</li>
				<!-- <li><label>创建时间：</label>
				<input name="starttime" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate "
					onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:false});" id="tid"/>
					至
					<input name="endtime" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate "
					onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:false});" id="tid"/>
					</li>
			 -->
			<li><label>来源：</label>
				<form:select path="come" class="input-medium required"   type="select[disabled]">
					<form:option value="">请选择</form:option>
					<form:options items="${fns:getDictList('come_type')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
				</form:select>
			</li>
			<li>
			<label>事件类别</label>
			<form:select path="type" class="input-medium required">
					<form:option value="">请选择</form:option>
					<form:options items="${fns:getDictList('type_type')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
				</form:select>
			</li>
			<li>
			<label>责任单位</label>
			<form:select  path="responsibilityunit" class="input-medium" >
				
					<form:options items="${list}" itemLabel="name" itemValue="id" htmlEscape="false"/>
					<form:option value="">请选择</form:option>
				</form:select>
			</li>
			<li>
			<label>督办单位</label>
			<form:select  path="supervisionunit" class="input-medium" >
				
					<form:options items="${list1}" itemLabel="name" itemValue="id" htmlEscape="false"/>
					<form:option value="">请选择</form:option>
				</form:select>
			</li>
			<li>
			<label>审核状态：</label>
			<form:select path="status" class="input-medium ">
					<form:option value="">请选择</form:option>
					<form:options items="${fns:getDictList('tb_project_plan_status')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
				</form:select>
					
			</li>
			<li><label>关键字检索：</label>
				<input name="quanwen"  maxlength="255" class="input-medium"/>
			</li>
			<!-- <li>&nbsp;&nbsp;<label>审核时间：</label>
				<input name="startshentime" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate "
					onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:false});" id="tid"/>
					至
					<input name="endshentime" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate "
					onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:false});" id="tid"/>
					</li> -->
			<li class="btns"><input id="btnSubmit" class="btn btn-primary" type="submit" value="查询" />
			</li>
			<li class="clearfix"></li>
		</ul>
	</form:form>
	<sys:message content="${message}"/>
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead>
			<tr>
				<th>登记编号</th>
				<th>信息内容</th>
				<th>申请时间</th>
				<th>申请人员</th>
				<th>延期原因</th>
				<th>延期天数</th>
				<!-- <th>申请状态</th> -->
				<th>审核人</th>
				<th>审核时间</th>
				<th>拒绝原因</th>
				<th>审核结果</th>
				<th>查看</th>
			</tr>
		</thead>
		<tbody>
		<c:forEach items="${page.list}" var="yhcgDelay">
			<tr>
			<td>
					<span title="${yhcgDelay.number}" >${fn:substring(yhcgDelay.number, 0, 10)}</span>	
				</td>
				<td>
				<span title="${yhcgDelay.content}" >${fn:substring(yhcgDelay.content, 0, 10)}</span>	
				</td>
				<td>
				<fmt:formatDate value="${yhcgDelay.yantime}" pattern="yyyy-MM-dd HH:mm:ss"/>
				</td>
				<td>
					${yhcgDelay.name}
				</td>
				<td>
				<span title="${yhcgDelay.reasonsfodelay}" >${fn:substring(yhcgDelay.reasonsfodelay, 0, 10)}</span>	
				</td>
				<td>
					${yhcgDelay.extensiondays}
				</td>
				
				
				<%-- <td>
				${fns:getDictLabel(yhcgDelay.status, 'tb_project_plan_status', '')}
				</td> --%>
				<td>
				${yhcgDelay.shenuser}
				</td>
				<td>
				<fmt:formatDate value="${yhcgDelay.shentime}" pattern="yyyy-MM-dd HH:mm:ss"/>
				</td>
				<td>
					<span title="${yhcgDelay.ju}" >${fn:substring(yhcgDelay.ju, 0, 10)}</span>	
				</td>
				<td>
				<c:if test="${yhcgDelay.status eq '0' }">
					<a onclick="jujue('${yhcgDelay.id}','${yhcgDelay.uid}')" style="cursor:pointer;">审核</a>
				</c:if>
					<c:if test="${(yhcgDelay.status eq '1')||(yhcgDelay.status eq '2') }">
					${fns:getDictLabel(yhcgDelay.status, 'tb_project_plan_status', '')}
					</c:if>
				</td>
				<td>
						<a href="${ctx}/numberinfo/yhcgNumberinfo/formchakan?id=${yhcgDelay.uid}">查看</a>
				</td>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${page}</div>
	 <div class="modal fade" id="demoModal"  style="width: 600px;height:400px;display: none; ">
        <div class="modal-dialog" >
             <div class="modal-content">
                 <div class="modal-header">
                      <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                      <h4 class="modal-title" id="demoModalLabel">延期审核</h4>
                 </div>
                 <div class="modal-body" style="height: 99%;">
                 <form id="formdatayan" action="${ctx}/delay/yhcgDelay/fromdataguo" method="post" >
                 <table>
                 	<tr>
                 	<td width="80px">
                 	<input type="hidden" id="id" name="id">
                 	事件来源:
                 	</td>
                 	<td id="come1" >
                 	</td>
                 	<td width="80px">
                 	事件类别:
                 	</td>
                 	<td id="type1">
                 	</td>
                 	</tr>
                 	<tr>
                 	<td>主要内容:</td>
                 	<td id="content1" colspan="3"></td>
                 	</tr>
                 	<tr>
                 	<td>事件备注:</td>
                 	<td id="remark1" colspan="3">
                 	</td>
                 	</tr>
                 	<tr>
                 	<td>申请原因:</td>
                 	<td id="shenyuan" colspan="3">
                 	</td>
                 	</tr>
                 	<tr>
                 	<td>申请人:</td>
                 	<td id="shenren" >
                 	</td>
                 	<td>延期天数:</td>
                 	<td  >
                 	<input name=extensiondays  type="text"  id="extensiondays"/>
                 	</td>
                 	</tr>
                 	<tr>
                 	<td>
                 	审核人:
                 	</td>
                 	<td >
                 	 <input type="text" name="shenuser" id="shenuser" placeholder="请输入审核人" class="required">
                 	</td>
			        <td width="60px">
			    	    审核结果
                 	</td>
                 	<td>
                 	  <select name="status" style="width: 150px" id="status1">
                 	  <option value="1">审核通过</option>
                 	  <option value="2">审核拒绝</option>
                 	  </select>
                 	</td>
                 	<td></td>
                 	</tr>
                 	 <tr>
                 	<td>
                 	备注信息:
                 	</td>
                 	<td colspan="3">
                 	 <textarea  id="ju" name="ju"  style="width: 400px" placeholder="此为审核拒绝时填写的原因"></textarea>
			        </td>
                 	</tr>
                 	</table>
                     <button type="button" class="btn btn-primary" data-dismiss="modal" onclick="shangchuan()" >提交</button>
                      <button type="button" class="btn btn-default" data-dismiss="modal" onclick="quxiao()" >取消</button>
                     </form>
                     </div>
             </div>
         </div>
    </div> 
</body>
</html>